function showLoading() {
  wx.showLoading({
    title: '加载中...',
    mask: true,
  })
}
function hideLoading() {
    wx.hideLoading()
}
function showNoNetwork() {
  showError('网络错误，请检查网络后再试~')
}
function showBookError() {
  showError('预订失败！请联系客服~')
}
function showMsg(msg, d) {
  const duration = Math.max(1000, msg.length * 200)
  wx.showToast({
    title: msg,
    icon: 'none',
    duration: d || duration,
    mask: false,
  })
  return duration
}
function showError(msg, d) {
  const duration = Math.max(1500, msg.length * 300)
  wx.showToast({
    title: msg,
    icon: 'error',
    duration: d || duration,
    mask: true,
  })
  return duration
}
function showSuccess(msg, d) {
  const duration = Math.max(1000, msg.length * 150)
  wx.showToast({
    title: msg,
    icon: 'success',
    duration: d || duration,
    mask: true,
  })
  return duration
}
module.exports = {
  showLoading,
  hideLoading,
  showError,
  showMsg,
  showSuccess,
  showNoNetwork,
  showBookError,
}
